<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:shiro="http://shiro.apache.org/tags">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ViewUploadsTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <p:layout fullPage="true">
                <p:layoutUnit position="north" size="90">
                    <h:panelGrid columns="3">
                        <p:graphicImage value="/resources/ikey.png" /> 
                        <table class="logintbl">
                            <tr>
                                <td><strong>Logged as:</strong>&nbsp;#{shiroLoginBean.username}&nbsp;|</td>
                                <td><h:form><h:commandLink action="#{logout.submit}" value="logout"/></h:form></td>
                            </tr>
                        </table>
                    </h:panelGrid>
                </p:layoutUnit>
                <p:layoutUnit position="west" size="200">
                    <p:panel header="Navigate">
                        <table border="0" class="teble">
                            <tr><td><p:commandLink styleClass="ui-icon ui-icon-folder-collapsed" action="/uploads/List"/></td><td><h:link outcome="/uploads/List" value="Uploads"/></td></tr>
                            <shiro:hasRole name="admin">
                                <tr><td><p:commandLink styleClass="ui-icon ui-icon-info" action="/userrole/List"/></td><td><h:link outcome="/faces/configs.xhtml" value="Server Status"/></td></tr>
                                <tr><td><p:commandLink styleClass="ui-icon ui-icon-person" action="/users/List"/></td><td><h:link outcome="/users/List" value="System Users"/></td></tr>
                            </shiro:hasRole>
                        </table>
                    </p:panel>
                </p:layoutUnit>
                <p:layoutUnit position="center">
                    <p:panel header="Document View">
                        <h:panelGroup id="messagePanel" layout="block">
                            <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                        </h:panelGroup>
                        <h:form>
                            <h:panelGrid columns="2">
                                <h:outputText value="#{bundle.ViewUploadsLabel_id}"/>
                                <h:outputText value="#{uploadsController.selected.id}" title="#{bundle.ViewUploadsTitle_id}"/>
                                <h:outputText value="#{bundle.ViewUploadsLabel_document}"/>
                                <h:outputText value="#{uploadsController.selected.document}" title="#{bundle.ViewUploadsTitle_document}"/>
                                <h:outputText value="#{bundle.ViewUploadsLabel_uploadedby}"/>
                                <h:outputText value="#{uploadsController.selected.uploadedby}" title="#{bundle.ViewUploadsTitle_uploadedby}"/>
                                <h:outputText value="#{bundle.ViewUploadsLabel_uploaddate}"/>
                                <h:outputText value="#{uploadsController.selected.uploaddate}" title="#{bundle.ViewUploadsTitle_uploaddate}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                            </h:panelGrid>
                            <table>
                                <tr><shiro:hasRole name="admin">
                                        <td><h:commandLink id="del" action="#{uploadsController.destroyAndView}" value="#{bundle.ViewUploadsDestroyLink}"/>&nbsp;|</td>
                                        <p:tooltip for="del" value="Delete" showEffect="highlight" hideEffect="drop"/>
                                    </shiro:hasRole>
                                    <td><h:link id="edi" outcome="Edit" value="#{bundle.ViewUploadsEditLink}"/>&nbsp;|</td>
                                    <td><h:commandLink id="cre" action="#{uploadsController.prepareCreate}" value="#{bundle.ViewUploadsCreateLink}" />&nbsp;|</td>
                                    <td><h:commandLink id="al" action="#{uploadsController.prepareList}" value="#{bundle.ViewUploadsShowAllLink}"/>&nbsp;|</td>
                                    <shiro:hasRole name="admin">
                                        <td><h:link id="ome" outcome="/index" value="#{bundle.ViewUploadsIndexLink}"/></td>
                                        <p:tooltip for="ome" value="Home" showEffect="highlight" hideEffect="drop"/>
                                    </shiro:hasRole>
                                </tr>
                            </table> 

                            <p:tooltip for="edi" value="Edit" showEffect="highlight" hideEffect="drop"/>
                            <p:tooltip for="cre" value="Create new item" showEffect="highlight" hideEffect="drop"/>
                            <p:tooltip for="al" value="Show all items" showEffect="highlight" hideEffect="drop"/>
                        </h:form>
                    </p:panel>
                </p:layoutUnit>
            </p:layout>
        </ui:define>
    </ui:composition>
</html>
